<template>
<div class='page'>
  <div class='nav'>
    <div class="input_div flex_ac" @click="$back() ">
      <van-icon class="ml6" name="arrow-left" size="26" color="#000"/>
      <div class="nav_title">我的会议</div>
      <!-- <img class="mla mr10" width="22px" height="22px" src="~@/assets/img/xiangxian/search.png" alt=""> -->
    </div>
    <div class="mt5 type_div flex">
      <div class="type_item" :class="type_id==i.id?'type_item_a':''"
        v-for="i,k in typeList" :key="k"
        @click="type_id=i.id"> {{i.name}} </div>
    </div>
	</div>
  <div class="h88"></div>
  <div class="box_div"  ref="gun">
    <van-list
      v-model="isLoad"
      :finished="isfinish"
      finished-text="没有更多了"
      @load="getMore">
      <div class="item_div"  v-for="i,k in list" :key="k" @click="toDetail(i.id)">
        <div class="flex">
          <div class="img_div mr10">
            <img class="i_img" :src="i.img" alt="">
            <div class="i_text">招商会</div>
          </div>
          <div class="w-120">
            <div class="item_title text_line2">{{ i.title }}</div>

            <div class="flex_ac mb6 mt10">
              <img class="i_icon mr10" src="~@/assets/img/huiyi/add.png" alt="">
              <div class="small">{{ i.address || '石家庄国际会展中心' }}</div>
            </div>
            <div class="flex_ac">
              <img class="i_icon mr10" src="~@/assets/img/huiyi/time.png" alt="">
              <div class="small">{{ '2024-07-04 ～ 2024-07-06' }}</div>
              <!-- i.end_time + '~ ' + i.end_time -->
            </div>
          </div>
        </div>
        <div class="status_div">已报名</div>
        <div class="line_h mt20"></div>
        <div class="flex_sb flex_ac w100 h50">
          <div class="mra"></div>
          <div class="flex_ac btn_item" @click.stop="toCode(i)">
            <img class="icon" src="~@/assets/img/huiyi/2wm.png" alt="">
            <div>二维码</div>
          </div>
          <div class="flex_ac btn_item" @click.stop="">
            <img class="icon" src="~@/assets/img/huiyi/saoma.png" alt="">
            <div>扫码</div>
          </div>
          <div class="flex_ac btn_item" @click.stop="toDel(i)">
            <img class="icon" src="~@/assets/img/huiyi/del.png" alt="">
            <div>删除</div>
          </div>
        </div>
      </div>
    </van-list>
  </div>
</div>
</template>
<script>
import Shaixuan from '@/components/Shaixuan.vue'
import { news } from '@/api/api.js'
export default {
  components: {
    Shaixuan
  },
  data() {
    return {
      typeList: [
        {name:'全部',id:''},
        {name:'已报名',id:'1'},
        {name:'已签到',id:'2'},
        {name:'已完成',id:'3'},
        {name:'未参加',id:'4'},
      ],
      type_id: 0,
      
      total: 0,
      page: 1,
      isfinish: false,
      isLoad: true,
      list:[]
    }
  },
  created() {
    this.init()
  },
  watch: {
    type_id: function () {
      this.init()
    }
  },
  methods: {
    toCode(i) {
      this.$router.push({name:'huiyiCode',query:{img:i.img}})
    },
    toDel(i) {
      this.$dialog.confirm({
        title: '提示',
        message: '确定删除会议吗',
      })
      .then(() => {
        
      })
      .catch(() => {
        
      });
    },
    changeInit(query) {
      this.query = query
      this.init()
    },
    init() {
      this.page = 1
      this.isfinish = false
      this.isLoad = true
      this.list = []
      this.getList()
    },
    getMore() {
      if (this.isfinish||this.list.length==0) {
        return
      }
      this.page++
      this.getList()
    },
    getList() {
      let data = {
        page: this.page,
        type_ids:'119',
        ...this.query
      }
      news.getList({...data}).then(res => {
        this.isLoad = false
        this.list.push(...res.data.data)
        this.total = res.data.total
        if (this.list.length >= this.total) {
          this.isfinish = true
        }
      })
    },
    toDetail(id) {
      this.$router.push({name: 'huiyiDetail', query: {id}})
    }
  }
}
</script>
<style lang="scss" scoped>
.nav{
	width: 100%;
	position: fixed;
	top: 0;
	left: 0;
	background-color: rgba($color: #fff, $alpha: 1);
	z-index: 10;
	transition: all 0.5s;
}
.input_div{
	width: 100%;
  height: 40px;
	.nav_title{
		font-weight: 500;
		font-size: 18px;
		color: #000;
	}
}

.page{
	height:100%;
	width:100%;
	background: #F4F4F4;;
  .total{
    margin-left: 10px;
    font-size: 10px;
    color: #333333;
  }
}
.box_div{
  // margin: 0 10px 10px;
  // padding: 10px;
  // background: #FFFFFF;
  // box-shadow: 0px 3px 9px 2px rgba(250,135,30,0.13);
  // border-radius: 4px 4px 4px 4px;
  height: calc(100% - 115px);
  overflow: auto;
  .item_div{
    background: #FFFFFF;
    box-shadow: 0px 3px 9px 2px rgba(68,142,238,0.13);
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
    margin: 10px 5px;
    padding: 20px 10px;
    padding-bottom: 0;
    .item_title{
      font-size: 15px;
      color: #000000;
      margin: 0px 0px 5px 0px;
    }
    .item_desc{
      font-size: 13px;
      color: #000000;
      line-height: 23px;
      margin: 0px 0px 6px 0px;
    }
    .small{
      font-size: 12px;
      color: #666666;
    }
    .s1{
      font-size: 13px;
      color: #138AF2;
    }
  }
}
.img_div{
  position: relative;
  height: 85px;
  .i_text{
    position: absolute;
    right: 0;
    bottom: 0;
    height: 19px;
    line-height: 19px;
    background: #FA8A26dd;
    border-radius: 5px 0px 3px 0px;
    padding: 0 7px;
    font-size: 11px;
    color: #FFFFFF;
  }
}
.i_img{
  display: inline-block;
  width: 110px;
  height: 85px;
  border-radius: 4px;
}
.i_icon{
  width: 10px;
  height: 10px;
}

.type_div{
	// position: sticky;
	// top: 0;
	position: relative;
	top:-5px;
	margin: 0 10px;
	background: #fff;
	height: 44px;
  line-height: 44px;
	.type_item{
		font-size: 15px;
		color: #000000;
		margin-right: 20px;
	}
	.type_item_a{
		color: #000;
		font-weight: bold;
		position: relative;
		&::after{
			content: '';
			position: absolute;
			left: 0;
			bottom: 0;
			width: 100%;
			height: 3px;
			border-radius: 2px;
			background: #FA8A26;
		}
	}
}

.status_div{
  position: absolute;
  right: 0;
  top: 0;
  height: 18px;
  border-radius: 0px 3px 0px 3px;
  color: #fff;
  background: #67C23A;
  line-height: 18px;
  padding: 0 8px;
  font-size: 11px;
}
.bg1{
  background: #67C23A;
}
.line_h{
  position: relative;
  width: calc(100% + 20px);
  left: -10px;
  height: 1px;
  background: #F0F0F0;
  box-shadow: 0px 2px 3px 0px rgba(24,27,37,0.06);
}

.btn_item{
  font-size: 13px;
  color: #000000;
}
.icon{
 width: 13px;
 height: 13px;
 margin-left: 35px;
 margin-right: 5px;
}
</style>